Quiz 4

Question # 1

Q

What is the default order in which rows are sorted by when using the ORDER BY clause?

A)

Ascending

B)

Descending

C)

Random

Question # 2

Q

Consider the following CREATE TABLE statement:

CREATE TABLE MyTable (
  ID INT AUTO_INCREMENT,
  PRIMARY KEY (ID));

Once the table is created, the following statements are executed:

INSERT INTO MyTable VALUES (21);
INSERT INTO MyTable VALUES ();

What will be the outcome of the following SELECT query:

SELECT * FROM MyTable ORDER BY ID;
A)

1 and 21

B)

21 and 22

C)

The second INSERT statement will give an error.

D)

The first INSERT statement will give an error.

Question # 3

Q

Consider the same setup from the previous question. A junior member from your team writes the following INSERT query:

INSERT INTO MyTable VALUES (NULL);

What will be the outcome of the SELECT query now?

SELECT * FROM MyTable ORDER BY ID;
A)

21, 22, 23

B)

23, 22, 21

C)

The INSERT statement will give an error

D)

1, 21, 22

Question # 4

Q

Consider the following setup:

-- Create table with a single column
CREATE TABLE MyTable (Name VARCHAR(20));

-- Insert a NULL value
INSERT INTO MyTable VALUES (NULL);

What will be the outcome of the following SELECT query:

SELECT *
FROM MyTable
WHERE Name = NULL;
A)

1 row with Name as NULL

B)

Empty Set

C)

Can’t insert a NULL value for the Name column

Question # 5

Q

Does UNION operator include duplicates?

A)

True

B)

False

Quiz 3
Quiz 5
Mark as Completed
Report an Issue